{% extends "layout.html" %}
{% set now_title = '文章管理'%} 
{% block web_title %}{{ now_title }}-{{ parent()}}{% endblock%}
{% block style%}
    <link href="/assign/admin/js/DataTables/css/data-table.css" rel="stylesheet">
{% endblock%}
{% block content%}
<div class="contentpanel">
    <div class="row">
        <div class="col-md-12">
            <p class="mb20">{{ now_title }}</p>
            <div class="table-responsive">
                <table class="table mb30">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>文章标题</th>
                            <th>所属分类</th>
                            <th>是否显示</th>
                            <th>修改时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for a in data %}
                        <tr>
                            <td>{{ a.id }}</td>
                            <td>{{ a.title }}</td>
                            <td>{{ a.cname }}</td>
                            <td>{{ a.is_use==0 ? '可用' : '不可用' }}</td>
                            <td>{{ a.updattime|date() }}</td>
                            <td class="table-action">
                                <a href="/admin/article/infoarticle/id/{{ a.id}}" title="編輯"><i class="fa fa-pencil"></i></a>
                                <a data-url="/admin/article/delarticle/id/{{ a.id}}" href="javascript:;" class="btn-del" title="刪除"><i class="fa fa-trash-o"></i></a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>

                </table>
            </div>
            <!-- table-responsive -->
            <div class="dataTables_paginate paging_full_numbers">
                {{ page| raw }}
                <!-- Row end -->
            </div>
        </div>
    </div>
</div>
<!-- contentpanel -->

{% endblock%} 
{% block script%}
<script>
    $('.btn-del').click(function() {
        var url = $(this).attr('data-url');
        //询问框
        layer.confirm('是否要删除这个文章？', {
            btn: ['确定', '取消'] //按钮
        }, function() {
            location.href = url;
        }, function() {

        });
    })
</script>
{% endblock%}